package com.jt.service;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.jt.mapper.UserMapper;
import com.jt.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    @Override
    public List<User> findAll() {
        return userMapper.selectList(null);
    }

    @Override
    public User select() {
        return userMapper.selectById(1);
    }

    @Override
    public void insert(User user) {
        userMapper.insert1(user);
    }

    @Override
    public void update() {
        User user = new User();
        user.setName("吉吉国王");
        UpdateWrapper updateWrapper = new UpdateWrapper();
        updateWrapper.eq("id", 237);
       userMapper.update(user,updateWrapper );
    }
}
